package cn.edu.sjtu.message_management.model;

import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

@Builder
@Data
@Document(collection = "message")
public class Message {

    private String id;
    private String messageId;
    private int type;
    private User fromUser;
    @Valid
    private List<User> toUser;
    private Date time;
    @NotBlank
    private String content;
    private String process;
    private String device;
    private boolean read;

    @Tolerate
    Message() {

    }
}
